﻿if (typeof(Admin) == 'undefined')
    Admin = {};
if (typeof (Admin.Product) == 'undefined')
    Admin.Product = {};

Admin.Product.Edit = {
    UpdatePhotosLink: function () {
        var link1 = $("#upload1").attr("filename");
        var link2 = $("#upload2").attr("filename");
        var link3 = $("#upload3").attr("filename");
        var link4 = $("#upload4").attr("filename");
        var link5 = $("#upload5").attr("filename");
        $("input[id$='photos1']").val(link1);
        $("input[id$='photos2']").val(link2);
        $("input[id$='photos3']").val(link3);
        $("input[id$='photos4']").val(link4);
        $("input[id$='photos5']").val(link5);
    },
    LoadPhoto: function () {
        $("#upload1").attr("filename") = $("input[id$='photos1']").val();
        $("#upload2").attr("filename") = $("input[id$='photos2']").val();
        $("#upload3").attr("filename") = $("input[id$='photos3']").val();
        $("#upload4").attr("filename") = $("input[id$='photos4']").val();
        $("#upload5").attr("filename") = $("input[id$='photos5']").val();
    },
    InitUploader: function () {
        var setting = { action: 'Service/UploadImageProduct.ashx' };
        Admin.Core.Uploader('upload1', setting);
        Admin.Core.Uploader('upload2', setting);
        Admin.Core.Uploader('upload3', setting);
        Admin.Core.Uploader('upload4', setting);
        Admin.Core.Uploader('upload5', setting);
    },
    Init: function () {
        this.InitUploader();
        //this.LoadPhoto();
    }
}

$(function () {
    Admin.Product.Edit.Init();
});
